package com.chenlong.pc.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.chenlong.pc.dao.HomeDao;
import com.chenlong.pc.dao.LogDao;
import com.chenlong.pc.entity.Home;

@Service
public class HomeService {

	private HomeDao homeDao;
	
	private LogDao logDao;
	
	@Autowired
	public void setHomeDao(HomeDao homeDao) {
		this.homeDao = homeDao;
	}
	
	@Autowired
	public void setLogDao(LogDao logDao) {
		this.logDao = logDao;
	}

	public List<Home> findAll(Map<String, Object> params) {
		return homeDao.findAll(params);
	}

	
	public Home findById(Map<String, Object> params) {
		return homeDao.findById(params);
	}

	
	public List<Home> findTop(Map<String, Object> params) {
		return homeDao.findTop(params);
	}

	
	public int countAll(Map<String, Object> params) {
		return homeDao.countAll(params);
	}

	public void delete(Map<String, Object> params, Map<String, Object> logParam) {
		homeDao.delete(params);
		logDao.save(logParam);
	}

	public void save(Map<String, Object> params, Map<String, Object> logParam) {
		homeDao.save(params);
		logDao.save(logParam);
	}

	public void update(Map<String, Object> params, Map<String, Object> logParam) {
		homeDao.update(params);
		logDao.save(logParam);
	}
	
}
